import pygame
from pygame.locals import *
from Picture import *

'''Class that helps the Class Viewer with his methods'''
class PictureClass:
    def __init__(self):
        pass

    '''Method that transforms one normal window in one full screen window'''
    #fullScreen is a boolean. If the window is normal, fullScreen = False
    #event is an object that comes of pygame.event.get()
    def fullScreen(self, screenSize, event, fullScreen):
        if not isinstance(screenSize, tuple):
            raise TypeError("screen size is a tuple, please put the right type")
        
        if not isinstance(fullScreen, bool):
            raise TypeError("full screen is a bool, please put the right type")
        
        if event.type == KEYDOWN:
            if event.key == K_f:
                fullScreen = not fullScreen
                if fullScreen:
                    screen = pygame.display.set_mode(screenSize,FULLSCREEN,32)
                else:
                    screen = pygame.display.set_mode(screenSize,0,32)
        return fullScreen
    
    '''The delta is one tuple with two elements that are the differences between
    the coordinates of one point and the coordinates of the top-left of one 
    rectangle'''
    # picture is one object of the type Picture
    def deltaOfPicture(self, picture, x, y):
        if not isinstance(picture, Picture):
            raise TypeError("picture is the type of Picture, please put the right type")
        
        if not isinstance(x, int) and not isinstance(y, int):
            raise TypeError("x and y are integers, please put the right type")
        
        deltaX = x - picture.getTopLeft()[0]
        deltaY = y - picture.getTopLeft()[1]
        return deltaX, deltaY